package com.yuelife.service.impl;

import com.yuelife.dao.SendpriceitemsDao;
import com.yuelife.dto.IdDTO;
import com.yuelife.dto.SendOrderDTO;
import com.yuelife.pojo.Sendpriceitems;
import com.yuelife.service.SendPriceItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author by Rxzeg
 * @date 2020-07-02 11:29
 * @describe
 */
@Service
public class SendPriceItemsServiceImpl implements SendPriceItemsService {
    @Autowired
    private SendpriceitemsDao sendpriceitemsDao;
    @Override
    public void add(SendOrderDTO sendOrderDTO, String order_id, IdDTO idDTO) {
        Sendpriceitems ss=new Sendpriceitems();
        //将DTO中的数据传给pojo对象
        ss.setBasicPrice(sendOrderDTO.getBasicPrice());
        ss.setDifficultPrice(sendOrderDTO.getDifficultPrice());
        ss.setDistancePrice(sendOrderDTO.getDistancePrice());
        ss.setSpecialTimePrice(sendOrderDTO.getSpecialTimePrice());
        ss.setWeightPrice(sendOrderDTO.getWeightPrice());
        ss.setOrderId(order_id);
        ss.setTotalPrice(sendOrderDTO.getTotalPrice());
        sendpriceitemsDao.insert(ss);
        idDTO.setS_id(ss.getId());
    }
}
